
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />
        
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/jquery.min.js?ver=<?= $config['version'] ?>"></script>
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/rgraph/libraries/RGraph.common.core.js" ></script>
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/rgraph/libraries/RGraph.line.js" ></script>
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/rgraph/libraries/RGraph.common.dynamic.js" ></script>	
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/jquery.min.js?ver=<?= $config['version'] ?>"></script>
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/rgraph/libraries/RGraph.common.core.js" ></script>
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/rgraph/libraries/RGraph.line.js" ></script>
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/rgraph/libraries/RGraph.common.dynamic.js" ></script>	
		<script type="text/javascript" src="<?= $config['res_url']?>/js/rgraph/libraries/RGraph.bar.js"></script>

	
    </head>
    <body>
        <?php include(VIEWPATH . 'common/main_header.php'); ?>
        
        
        
        <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tablegrid tableedit">
    
 	 <tr>
        </center><td><!--&nbsp;
       <center>
       	 渠道名字 :<?=$channel ?>&nbsp;&nbsp;
       	平台:<?=$platform ?>&nbsp;&nbsp;
       	系统版本:<?=$osver ?>&nbsp;&nbsp;
       	联网类型:<?=$network ?>&nbsp;&nbsp;
       	设备类型:<?=$device ?>&nbsp;&nbsp;
       	游戏版本:<?=$gamever ?>&nbsp;&nbsp;
       &nbsp;&nbsp;
       	开始时间:<?= $startTime ?> &nbsp;&nbsp;
       	结束时间:<?= $endTime ?></center>--></td>          
     </tr>
     
     
     <tr>
       <td>
     
       <table border='1'>
       <tr>
       		<?php
     		$todayremainfirstdaynum = "";  //不初始化可能会遇到字符串中有array的情况
     		$remainrate = "";
    		$labels = "";
    		$i = 0;
    		$j = 0;
      		?>
       		<td><?= translate('BUSINESSDATA_MANAGERROLE_DATE')?></td>
       <?php foreach ($remainData as $key=>$value) {?>
       		<td>&nbsp;<?=$key ?></td>  
       		<?php 
       		$key = str_replace("-", ".", $key);
       		$labels .= "'".$key."'".",";
       		//print_r($labels);
			}?>    		
       </tr>

       <tr>
       		<td><?= translate('BUSINESSDATA_MANAGERROLE_TODAYREGISTERNUM')?></td>
       <?php foreach ($remainData as $key=>$value) {?>
       		<td>&nbsp; <?=$value['todayregisternum'] ?></td>  
       		<?php }?>		
       </tr>
       <tr>
       		<td><?= translate('BUSINESSDATA_MANAGERROLE_TODAYLOGINNUM')?></td>
       <?php foreach ($remainData as $key=>$value) {?>
       		<td>&nbsp; <?=$value['todayloginnum'] ?></td>		
       		<?php }?>
       </tr>
       <tr>
       		<td><?= translate('BUSINESSDATA_MANAGERROLE_REMAINFIRSTDAYNUM')?></td>
       <?php foreach ($remainData as $key=>$value) {?> 
       		<?php 
       		$todayremainfirstdaynum .= $value['todayremainfirstdaynum'].",";
       		//print_r($data);
       		 ?>		
       		 <td>&nbsp; 
       		 <?php $i == 0 ? $tmp = '-' : $tmp = $value['todayremainfirstdaynum'] ?>
       		 <?=$tmp?>
       		 </td> 
       		 <?php $i++; }?>
       </tr>
       <tr>
       		<td><?= translate('BUSINESSDATA_MANAGERROLE_REMAINRATE')?></td>
       <?php foreach ($remainData as $key=>$value) {?> 
       		<?php 
       		$remainrate .= $value['remainrate'].",";
       		//print_r($data);
			?> 		
			<td>&nbsp;
			<?php $j == 0 ? $tmp2 = '-' : $tmp2 = $value['remainrate'] ?> 
			<?=$tmp2 ?>
			</td> 
			<?php $j++; }?>
       </tr>
       <?php 
         	$labels = substr($labels, 0, -1);
         	$remainrate = substr($remainrate, 0, -1);
         	//var_dump($labels);
         	//var_dump($remainrate);
         	//exit(0);
         	?>
       </table>
       
       </td>
     </tr>
   </table>
        
    <!-- <canvas id="cvs" width="1700" height="500" style="border: 1px solid #ddd">[No canvas support]</canvas>  -->
        
        <form action="" method="POST" id="rowForm">
            <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tablegrid tableedit">
            
            <tr><td><?= translate('STARTTIME') ?>:</td><td><input type='text' name='row[starttime]' id='starttime' class='datepicker' value="<?= $startTime ?>"/></td></tr>
        <!-- <tr><td><?= translate('BUSINESSDATA_MANAGERROLE_CHANNEL') ?>:</td><td><?= $channel?></td></tr>  -->
            <!--    <tr><td><?= translate('ENDTIME') ?>:</td><td><input type="text" name="row[endtime]" id="endtime" class='datepicker'  value="<?= $endTime ?>"/></td></tr>
                
                <tr><td>选择分区:</td>
            		<td><select name="row[area]" id="area">
                      	<?php foreach ($areaList as $key => $value) {?>
            		    <option value="<?=$key ?>"><?=$value ?></option>
            		    <?php }?>
   		        </select></td></tr>  -->
   		        
                <tr><td></td><td>
	                <input type="submit" value="<?= translate('SHENGCHENG') ?>" id="submit"/> 
                </td></tr>
            </table>
   		</form>
   		
   		
   		
   		   		<script>
   		
    	        
    $(document).ready(
				function()
				{
					var line = new RGraph.Bar('cvs', [<?= $todayremainfirstdaynum?>]);
					line.Set("chart.title", "留存率");
					line.Set("chart.title.xaxis", "X轴/日期");  //指定x轴标题
			        line.Set("chart.title.yaxis", "Y轴/留存人数"); //指定y轴标题
			        //line.Set('chart.key', ['存量', '产量', '消耗量']);
			        line.Set('chart.gutter.left', 100);
			        line.Set('chart.gutter.right', 50);
			        line.Set('chart.gutter.top', 50);
			        line.Set('chart.gutter.bottom', 50);
			        line.Set('chart.variant', '3d');
			        //line.Set('chart.colors', ['red', 'green', 'blue']);
			        //line.Set('chart.key', ['总存量','总产量','总消耗']);
			        //line.Set('chart.key.position', 'gutter');
		            //line.Set('chart.key.position.gutter.boxed', false);
		            //line.Set('chart.key.position.x', 1000);
		            
					line.Set("chart.labels", [<?= $labels?>]);   //不能写成<?php ?>被坑死了！
					line.Set("chart.labels.above", true);
					line.Draw();
				}
    	    )
    	        
   	
    </script>
    <script type="text/javascript">
            SG.init("core.form", function() {
                $.formValidator.initConfig({formid: "#rowForm", submitonce: true});
                $("#starttime").formValidator({empty: false, onshow: '<?= translate('PLASE_WRITE') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                $("#channel").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                //$("#endtime").formValidator({empty: false, onshow: '<?= translate('PLASE_WRITE') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                //$("#platform").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                //$("#game").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});  
                //$("#server").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});                  
                //$("#type").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
            });
        </script>
   		
   		
   </body>
   </html>